package com.server.commons.sms.base;

import com.server.common.code.error.BusinessException;
import com.server.common.code.utils.PatternUtils;
import com.server.common.code.utils.StringUtils;
import com.server.commons.sms.bo.SendSmsBo;
import com.server.commons.sms.interfaces.SmsInterface;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.ObjectUtils;

@Slf4j
public class BaseSmsInterface implements SmsInterface {

    @Override
    public void sendSms(SendSmsBo sendSmsBo) {

        if(!PatternUtils.hasMobile(sendSmsBo.getMobile())){
            throw new BusinessException("手机号不合法");
        }

        if(ObjectUtils.isEmpty(sendSmsBo.getTplId())){
            throw new BusinessException("异常问题");
        }

        if(ObjectUtils.isEmpty(sendSmsBo.getCode())){
            throw new BusinessException("异常问题");
        }

    }

    @Override
    public void sendRegisterSms(String mobile, String code) {
    }

    @Override
    public void sendLoginSms(String mobile, String code) {
    }

    @Override
    public void sendSmsForgetPassword(String mobile, String code){
    }
}
